//
//  ViewController.swift
//  ParsingWithCodable
//
//  Created by liy on 2024/10/9.
//

import UIKit

class ViewController: UIViewController {
  override func viewDidLoad() {
    super.viewDidLoad()

    whyTisOptional()
  }

  func testBundleExtension() {
    let result = loadMainBundleFile("data", "json", MyDataModel.self)

    switch result {
    case let .success(model):
				print("Successfully loaded model: \(model)")
    case let .failure(error):
      print("Error loading file: \(error)")
    }
  }

  func whyTisOptional() {
    let result = loadMainBundleFile("id", "json", User.self)

    switch result {
    case let .success(model):
				print("Successfully loaded model: \(model)")
    case let .failure(error):
      print("Error loading file: \(error)")
    }
  }
}
